package com.poorstu.web;

import java.text.SimpleDateFormat;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.common.base.model.PaginationSupport;
import com.common.base.web.BaseAction;
import com.poorstu.manager.LeaseManager;
import com.poorstu.manager.PartTimeManager;
import com.poorstu.model.LeaseMod;
import com.poorstu.model.PartTimeMod;

public class LeaseAndPartTimeAction extends BaseAction {
	
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {

		try{
		LeaseManager leaseMag=(LeaseManager)getBean("leaseManager");
		 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		List<LeaseMod> leaseList = leaseMag.selectLeaseForTen();
		for(int i=0;i<leaseList.size();i++){
			leaseList.get(i).setPageTime(sdf.format(leaseList.get(i).getLeaTime()));
		}
		PartTimeManager partTime=(PartTimeManager)getBean("partTimeManager");
		
		List<PartTimeMod> partList=partTime.selectPartTimeForTen();

		request.setAttribute("leaseList", leaseList);
		request.setAttribute("partList", partList);
		
		}catch(Exception e){
			e.printStackTrace();
			return mapping.findForward("failure");
		}
		
		return mapping.findForward("succ");
	}
	
	

}
